from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from pirate_core import HttpRedirectException, namespace_get, FormMixin, template_for_model

class Profile(models.Model):
    bio = models.TextField(max_length=1000, default = "", blank=True)
    birth_date = models.DateTimeField('birth_date')
    user = models.ForeignKey(User)

    def __unicode__(self):
        return self.user.username

    def get_absolute_url(self):
        content_type = ContentType.objects.get_for_model(self.__class__)
        content_type2 = ContentType.objects.get_for_model(self.user)
        path = template_for_model(str(content_type)) + "?_t=" + str(content_type2.pk) + "&_o=" + str(self.user.pk) 
        return path
